<?php
    if( isset($_GET['cource']) &&
        $_GET['cource'] >= 1   &&
        $_GET['cource'] <= 5) 
    {
        $cource = $_GET['cource'];
        $votes = file('votes');
        $votes[$cource - 1] += 1;
		
        $str = '';
        foreach($votes as $vote) {
            $str .= (int)$vote."\n";
        }
		
        $fd = fopen('votes', 'w');
        fwrite($fd, $str);
        fclose($fd);   
    }
    header('Location:index.php');
?>
